﻿using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
namespace Common.Swagger.Filter
{
    /// <summary>
    /// 传入lone参数更改为string类型
    /// </summary>
    public class LongParameterFilter : IParameterFilter
    {
        public void Apply(OpenApiParameter parameter, ParameterFilterContext context)
        {
            Type type = context.ParameterInfo.ParameterType;
            if (type == typeof(long) || type == typeof(long?))
            {
                parameter.Schema.Type = "string";
                parameter.Schema.Format = "string";
            }
        }
    }
}
